* "Targeting Coethnic Voters, Elites or Both?"
* Unit of Analysis: Constituency-Year
* Matched data set
* Dongil Lee
* 10/4/2024

/*=================================*/
/* Nearest Neighbor Matching (NMM) */
/* Mahalanobis distance            */
/*=================================*/

* Table A12.

/****************/
/*   Regime 1.  */
/****************/

cd "/Users/dlee/Dropbox/Work/NYU/2016 Summer/MA_thesis/combined_data"

use nnm1.dta, clear
set more off

cd "/Users/dlee/Dropbox/Work/NYU/2016 Summer/MA_thesis/output"

global aid log_d_aidpc
global ctrl logpop infant gender same_const min ruling i.year /* with year fixed effects */
xtset const_code year

estimates drop _all
eststo est1: xtreg $aid i.MPcoethnic1##i.regime1 $ctrl, fe vce(cluster const_code)

estadd local matched "\checkmark" : est*
estadd local const_fe "\checkmark" : est*
estadd local year_fe "\checkmark" : est*

estout est* ///
using dd_nnm1.xls, replace nolabel ///
keep(1.MPcoethnic1#1.regime1) ///
starlevels(* 0.10 ** 0.05 *** 0.01) ///
label cells(b(star fmt(2)) se(par(`"="("'`")""') fmt(%9.2f))) ///
stats(matched const_fe year_fe r2 N, ///
labels("Matched sample?" "Constituency FE" "Year FE" "\$R^2\$" "N") ///
fmt(%9.0g %9.0g %9.0g %10.2f %9.0g))

/****************/
/*   Regime 2.  */
/****************/

cd "/Users/dlee/Dropbox/Work/NYU/2016 Summer/MA_thesis/combined_data"

use nnm2.dta, clear
set more off

cd "/Users/dlee/Dropbox/Work/NYU/2016 Summer/MA_thesis/output"

global aid log_d_aidpc
global ctrl logpop infant gender same_const min ruling i.year /* with year fixed effects */
xtset const_code year

estimates drop _all
eststo est2: xtreg $aid i.MPcoethnic2##i.regime2 $ctrl, fe vce(cluster const_code)

estadd local matched "\checkmark" : est*
estadd local const_fe "\checkmark" : est*
estadd local year_fe "\checkmark" : est*

estout est* ///
using dd_nnm2.xls, replace nolabel ///
keep(1.MPcoethnic2#1.regime2) ///
starlevels(* 0.10 ** 0.05 *** 0.01) ///
label cells(b(star fmt(2)) se(par(`"="("'`")""') fmt(%9.2f))) ///
stats(matched const_fe year_fe r2 N, ///
labels("Matched sample?" "Constituency FE" "Year FE" "\$R^2\$" "N") ///
fmt(%9.0g %9.0g %9.0g %10.2f %9.0g))

/****************/
/*   Regime 3.  */
/****************/

cd "/Users/dlee/Dropbox/Work/NYU/2016 Summer/MA_thesis/combined_data"

use nnm3.dta, clear
set more off

cd "/Users/dlee/Dropbox/Work/NYU/2016 Summer/MA_thesis/output"

global aid log_d_aidpc
global ctrl logpop infant gender same_const min ruling i.year /* with year fixed effects */
xtset const_code year

estimates drop _all
eststo est3: xtreg $aid i.MPcoethnic3##i.regime3 $ctrl, fe vce(cluster const_code)

estadd local matched "\checkmark" : est*
estadd local const_fe "\checkmark" : est*
estadd local year_fe "\checkmark" : est*

estout est* ///
using dd_nnm3.xls, replace nolabel ///
keep(1.MPcoethnic3#1.regime3) ///
starlevels(* 0.10 ** 0.05 *** 0.01) ///
label cells(b(star fmt(2)) se(par(`"="("'`")""') fmt(%9.2f))) ///
stats(matched const_fe year_fe r2 N, ///
labels("Matched sample?" "Constituency FE" "Year FE" "\$R^2\$" "N") ///
fmt(%9.0g %9.0g %9.0g %10.2f %9.0g))
